<?php 
    echo $this->Html->script(array(
        'app/vehiculos/lib_vehiculosEdicion'
    ), array('inline'=>false));
    
    $idVehiculo = "";
	$idCliente = "";
	$numeroPlaca = "";
	$anio = "";
	$idMarcaItem = "";
	$modelo = "";
	$color = "";
	$idCombustibleItem = "";
	
	if(isset($objVehiculo)){
		if(count($objVehiculo)>0){
			$idVehiculo = $objVehiculo["Vehiculo"]["idVehiculo"];
			$idCliente = $objVehiculo["Vehiculo"]["idCliente"];
			$numeroPlaca = $objVehiculo["Vehiculo"]["numeroPlaca"];
			$anio = $objVehiculo["Vehiculo"]["anio"];
			$idMarcaItem = $objVehiculo["Vehiculo"]["idMarcaItem"];
			
			$modelo = $objVehiculo["Vehiculo"]["modelo"];
			if($modelo == null){$modelo = "";}
			
			$color = $objVehiculo["Vehiculo"]["color"];
			$idCombustibleItem = $objVehiculo["Vehiculo"]["idCombustibleItem"];
		}
	}
    
?>
<?php if(isset($msjRegistroVehiculo)) {?>
<script type="text/javascript">
jAlert('<?php echo $msjRegistroVehiculo; ?>',TITULO_MENSAJE);
</script>
<?php }?>
<div class="subtitulo">
	<div class="divBannerCabecera" align="left">
		<table border="0" cellpadding="1">
			<tr>
			<td><img src="<?php echo Router::url('/img/iconos/icono_autos.png',false); ?>" width="45" height="45" border="0" alt="" title="" /></td>
			<td width="3%"></td>
			<td>Nuevo Veh&iacute;culo</td>
			</tr>
		</table>
	</div>
</div>
<br />
<div class="cuerpoPagina">
<fieldset class="fieldsetForm">
	<legend class="ui-widget-header">Datos de Veh&iacute;culo</legend>
	<div align="center">
	
	<form id="formRegistro" name="formRegistro" action="<?php echo Router::url("/Vehiculos/guardar_vehiculo"); ?>" method="post">
		<input type="hidden" id="idVehiculo" name="data[Vehiculo][idVehiculo]" value="<?php echo $idVehiculo; ?>" />
		<table border="0">
			<tr>
				<td align="right">N&uacute;mero Placa : </td>
				<td align="left"><input type="text" id="numeroPlaca" name="data[Vehiculo][numeroPlaca]" maxlength="30" value="<?php echo $numeroPlaca; ?>" /></td>
				<td align="center" width="4%"></td>
				<td align="right">Marca : </td>
				<td align="left">
					<select name="data[Vehiculo][idMarcaItem]" id="idMarca">
						<?php 
						$dimMarcas = count($marcasVehiculos);
						$selected = "";
						for($i = 0;$i<$dimMarcas;$i++){ 
							$objMarca = $marcasVehiculos[$i]["CatalogoDetalle"];
							
							if($objMarca["idItem"] == $idMarcaItem){
								$selected="selected='selected'";
							}else{
								$selected="";
							}
						?>
						<option value="<?php echo $objMarca["idItem"];?>" <?php echo $selected; ?>><?php echo utf8_encode($objMarca["descripcion"]); ?></option>
						<?php } ?>
					</select>
				</td>
				<td align="center" width="4%"></td>
				<td align="right">Modelo : </td>
				<td align="left">
					<input type="text" id="color" name="data[Vehiculo][modelo]" maxlength="30" value="<?php echo $modelo; ?>" />
				</td>
			</tr>
			<tr>
				<td align="right">A&ntilde;o : </td>
				<td align="left"><input type="text" id="anio" name="data[Vehiculo][anio]" maxlength="4" value="<?php echo $anio; ?>" /></td>
				<td align="center" width="4%"></td>
				<td align="right">Color : </td>
				<td align="left"><input type="text" id="color" name="data[Vehiculo][color]" maxlength="30" value="<?php echo $color; ?>" /></td>
				<td align="center" width="4%"></td>
				<td align="right">Tipo combustible : </td>
				<td align="left">
					<select name="data[Vehiculo][idCombustibleItem]" id="idCombustible">
						<option value="">[Ninguno]</option>
						<?php 
						$dimCombustibles = count($tiposCombustibles);
						$selected = "";
						for($i = 0;$i<$dimCombustibles;$i++){ 
							$objCombustible = $tiposCombustibles[$i]["CatalogoDetalle"];
							
							if($objCombustible["idItem"] == $idCombustibleItem){
								$selected="selected='selected'";
							}else{
								$selected="";
							}
						?>
						<option value="<?php echo $objCombustible["idItem"];?>" <?php echo $selected;?>><?php echo $objCombustible["descripcion"]; ?></option>
						<?php } ?>
					</select>
				</td>
			</tr>
			<tr>
				<td align="right">Cliente :</td>
				<td align="left">
					<select name="data[Vehiculo][idCliente]" id="idCliente">
						<option value="">[Ninguno]</option>
						<?php 
						$dimClientes = count($clientes);
						$selected = "";
						for($i = 0;$i<$dimClientes;$i++){ 
							$objCliente = $clientes[$i]["Cliente"];
							
							if($objCliente["idCliente"] == $idCliente){
								$selected="selected='selected'";
							}else{
								$selected="";
							}
						?>
						<option value="<?php echo $objCliente["idCliente"];?>" <?php echo $selected;?>><?php echo $objCliente["nombreEntidad"]; ?></option>
						<?php } ?>
					</select>
				</td>
				<td align="center" width="4%"></td>
				<td align="right"></td>
				<td align="left"></td>
				<td align="center" width="4%"></td>
				<td align="right"></td>
				<td align="left"></td>
			</tr>
		</table>
	</form>
	</div>
	<br />
	<div align="center">
		<input id="btnGuardar" type="button" value="Guardar"
			onclick="fnGuardarVehiculo();" class="btn btnposicion"
   			style="background-image: url(<?php echo Router::url('/img/iconos/guardar.png',false); ?>)" />

   		<input id="btnConsultarVehiculos" type="button" value="Consultar Vehiculos"
			onclick="fnConsultarVehiculos();" class="btn btnposicion"
   			style="background-image: url(<?php echo Router::url('/img/iconos/buscar.png',false); ?>)" />
   			
   		<input id="btnNuevaOrden" type="button" value="Crear Orden de Trabajo"
			onclick="fnCrearOrdenTrabajo();" class="btn btnposicion"
   			style="background-image: url(<?php echo Router::url('/img/iconos/report.png',false); ?>)" />
	</div>
</fieldset>
</div>